Currently, in scenarios such as live streaming and live television (TV), a data live broadcast is widely applied (the data live broadcast is real-time display of data). Users can learn of corresponding information on time through the data live broadcast.
For example, a passenger flow volume in the Spring Festival transportation peak time can be displayed during the live TV and therefore, a user who watches the live TV can learn of the corresponding passenger flow volume in the Spring Festival transportation peak time. For another example, access traffic, a sales volume, etc. of a shopping website can be displayed on the website and therefore, a user who accesses the shopping website can learn of the access traffic and the sales volume on a corresponding page.
The live display of data is usually implemented by a live data service (the live data service runs on a corresponding server) on the server (or a server cluster). The live data service obtains data from a data source in real time, performs corresponding statistics processing to obtain live data, and sends the live data to a terminal device for display. It is worthwhile to note that an actual data live display process is essentially a time-delayed live broadcast. To be specific, there is a time difference between data displayed by the terminal device and data generated by the server, in other words, the live data displayed by the terminal device is usually generated by the server n seconds before.
However, in actual application scenarios, an exception may occur when the live data service runs (e.g., counting error or lagging), and corresponding service staff need to perform troubleshooting and recovery.
In the existing technology, when an exception occurs in the live data service, the server switches to a backup live data service to replace the abnormal live data service.
However, a “jump” or a rollback may occur in real-time data in the method of switching to the backup service for the following reason: the live data service running on the server buffers real-time data obtained from the data source, to perform corresponding statistics processing. If an exception occurs in the live data service and the live data service is replaced with the backup live data service, the real-time data stored in a buffer of the live data service is cleared, and the backup live data service buffers the real-time data again to perform statistics processing after the backup live data service runs. In this case, data statistics processing is repeatedly performed and therefore, a rollback occurs in the data live broadcast.
Using access traffic data as an example, an original live data service buffers real-time data a900 to a960 obtained from the data source, and performs statistics processing on the 60 pieces of data to generate access traffic data 900 to 960. Assume that the live data server generates access traffic data 930 to 950 based on real-time data a930 to a950, and sends the access traffic data to the terminal device for display. As shown in FIG. 1a, access traffic currently displayed by the terminal device based on the access traffic data sent by the server is 935.
If an exception occurs when the live data service generates access traffic data 955, the server stops the abnormal live data service, and enables a backup live data service to replace the abnormal live data service. After the backup live data service runs, the data buffered by the original live data service is cleared, and the backup live data service buffers the real-time data a900 to a960 again to perform statistics processing, generates access traffic data 900 to 920, and sends the access traffic data to the terminal device for display. In this case, after the terminal device displays access traffic 950 based on the access traffic data received previously (as shown in FIG. 1b), access traffic is rolled back to 900 based on the access traffic data 900 to 920 received recently, and the terminal device performs display starting from 900, as shown in FIG. 1c. It can be seen that this is the data rollback.
Apparently, such a method affects the live data displayed by the terminal device.